#light

let isWord (words: list<string>) =
    printfn "isWord executed"
    let wordTable = Set.Create(words)
    fun w -> wordTable.Contains(w)

let isCapitalPrecomputed = isWord ["London"; "Paris"; "Warsaw"; "Tokyo"]
let isCapitalNotPrecomputed inp = isWord ["London"; "Paris"; "Warsaw"; "Tokyo"] inp

print_endline "\nPrecomputed\n--------------------"
printfn "%A" (isCapitalPrecomputed "Paris")
printfn "%A" (isCapitalPrecomputed "Manchester")
print_endline "\nNOT Precomputed\n--------------------"
printfn "%A" (isCapitalNotPrecomputed "Paris")
printfn "%A" (isCapitalNotPrecomputed "Manchester")